import { ReactNode } from "react"
import { Navigate } from "react-router-dom"
import { getToken } from "@/utils"
const AuthRoute = memo(({ children }: { children: ReactNode }) => {
  const token = getToken()
  if(token){
    return <>{children}</>
  }else {
    // 直接跳转到对应的路由
    return <Navigate to="/login" replace></Navigate>
  }
})

export default AuthRoute